var express = require('express');
var router = express.Router();
var fs = require('fs');

/* GET users listing. */
router.get('/', function (req, res, next) {
  res.send('respond with a resource');
});


router.get('/getToken', function (req, res, next) {
  res.send({
    code: 200,
    result: true,
    sessionId: 'sdfds5415sdf453rsfdsr3wresfds'
  });
});



router.get('/getBanner', function (req, res, next) {
  let query = req.query;
  let sessionId = query.sessionId;
  if (query && query.sessionId && query.sessionId === 'sdfds5415sdf453rsfdsr3wresfds') {
    fs.readFile('./../../vueMusicCMS/publick/mock/banner.json', (err, data) => {
      if(err) {
        console.log(err);
      }

      res.send(data);
    })
  } else {

  }

});




router.get('/getHotSong', function (req, res, next) {
  res.send({
    code: 200,
    result: true,
    list: [4, 5, 6]
  });
});



module.exports = router;